<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <title>layui</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/static/crm/lib/layui-v2.6.3/css/layui.css" media="all">
    <link rel="stylesheet" href="/static/crm/css/public.css" media="all">
    <style>
        body {
            background-color: #ffffff;
        }
    </style>
</head>

<body>
    <form class="layui-form" action="">
        <div class="layui-form layuimini-form">
            <fieldset class="table-search-fieldset" style="border: 3px solid rgb(75, 75, 75);">
                <legend style="color: rgb(75, 75, 75);">基本信息</legend>
                <div class="layui-form-item">
                    <label class="layui-form-label ">名称：</label>
                    <div class="layui-input-block">
                        <input type="text" name="name" lay-verify="required" value="" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label ">电话：</label>
                    <div class="layui-input-block">
                        <input type="text" name="landline" value="" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label ">手机：</label>
                    <div class="layui-input-block">
                        <input type="text" name="phone" lay-verify="required" value="" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label">级别：</label>
                    <div class="layui-input-block">
                        <select name="grade" lay-ignore>
                            <option value="普通客户">普通客户</option>
                            <option value="重点客户">重点客户</option>
                            <option value="优质客户">优质客户</option>
                        </select>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">行业：</label>
                    <div class="layui-input-block">
                        <select name="industry" lay-ignore>
                            <option value="其他">其他</option>
                            <option value="房地产">房地产</option>
                            <option value="金融业">金融业</option>
                            <option value="商业服务">商业服务</option>
                            <option value="贸易">贸易</option>
                            <option value="运输物流">运输物流</option>
                            <option value="服务业">服务业</option>
                            <option value="文化传媒">文化传媒</option>
                            <option value="IT/互联网">IT/互联网</option>
                        </select>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label">来源：</label>
                    <div class="layui-input-block">
                        <select name="source" lay-ignore>
                            <option value="个人资源">个人资源</option>
                            <option value="广告">广告</option>
                            <option value="转介绍">转介绍</option>
                            <option value="搜索引擎">搜索引擎</option>
                            <option value="公司资源">公司资源</option>
                            <option value="电话咨询">电话咨询</option>
                            <option value="官网咨询">官网咨询</option>
                            <option value="公众号">公众号</option>
                            <option value="抖音">抖音</option>
                            <option value="企业微信">企业微信</option>
                        </select>
                    </div>
                </div>

                <div class="layui-form-item">
                    <label class="layui-form-label ">标签：</label>
                    <div class="layui-input-block">
                        <input type="text" name="label" value="" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label ">地址：</label>
                    <div class="layui-input-block">
                        <input type="text" name="address" value="" class="layui-input">
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label ">详细地址：</label>
                    <div class="layui-input-block">
                        <input type="text" name="detailed" value="" class="layui-input">
                    </div>
                </div>
                <div class="layui-inline">
                    <label class="layui-form-label">下次跟进时间：</label>
                    <div class="layui-input-inline">
                        <input name="follow_time" type="text" class="layui-input" id="test12" placeholder="">
                    </div>
                </div>

                <div class="layui-form-item layui-form-text">
                    <label class="layui-form-label">备注：</label>
                    <div class="layui-input-block">
                        <textarea name="remark" class="layui-textarea" placeholder="请输入备注信息"></textarea>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-input-block">
                        <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
                        <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                    </div>
                </div>
            </fieldset>
        </div>
    </form>





    <script src="/static/crm/lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
    <script>
        layui.use(['form', 'laydate','jquery'], function () {
            var form = layui.form,
                layer = layui.layer,
                laydate = layui.laydate,
                $ = layui.jquery;

            laydate.render({
                elem: '#test12'
            });
            // //监听提交
            // form.on('submit(formDemo)', function (data) {
            //     var index = layer.alert(JSON.stringify(data.field), {
            //         title: '最终的提交信息'
            //     }, function () {

            //         // 关闭弹出层
            //         layer.close(index);

                    // var iframeIndex = parent.layer.getFrameIndex(window.name);
                    // parent.layer.close(iframeIndex);

            //     });

            //     return false;
            // });

            form.on('submit(formDemo)', function (data) {
                $.ajax({
                    url: 'data',
                    type: 'post',
                    dataType: 'json',
                    data: data.field,
                    success: function (data) {
                        if (data.code == 1) {
                            layer.msg(data.msg,{
                                time:1500,
                                end: function (){
                                    var iframeIndex = parent.layer.getFrameIndex(window.name);
                                    parent.layer.close(iframeIndex);
                                }
                            });
                            
                        }else if (data.code == 0) {
                            layer.msg(data.msg);
                        }
                    }
                })
                return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。
            });

        });
    </script>
</body>

</html>